import React, { Component } from 'react';
import { wxShare } from '../../utils/weixinShare';
import {
    Flex,
    Icon,
    Modal,
    Carousel,
    WingBlank,
    WhiteSpace,
    Toast,
    SwipeAction,
    Popover
} from 'antd-mobile';

import Moment from 'moment';
import NoLazyImg from '../../components/NoLazyImg/NoLazyImg';

import shangxinTime from '../../assets/svg/shangxinTime.svg';
import {evalute_madel} from "../evaluate/EvaluateListItem.less";

import { routerRedux } from 'dva/router';




class MyStoreOrderItem extends Component {
    constructor(props){
        super(props);
        this.state={

        };

    }

    jiaru=()=>{
        const { v, dispatch } = this.props;
        dispatch({ type: 'distribution/joinStoreEFF', obj:{goodsId :v.goodsId ,distributorId :v.distributorId } }).then(result=>{
            if(result.code==200){
                Toast.success(result.msg,2,()=>{
                    this.props.refresh();
                })
            }else if(result.code==403){
                Toast.info(result.msg,2);
            }
        });
    }
    render () {
        const { v, dispatch ,my} = this.props;
        return (
            <div>
                <WingBlank>
                    <Flex justify="between" style={{padding:".2rem 0"}}>
                        <Flex>
                            <Icon type={shangxinTime.id} style={{color:"#999",marginRight:".1rem"}}></Icon>
                            <div style={{color:"#999"}}>{v.createTimeStr}创建</div>
                        </Flex>
                        <div className="state" style={
                            v.orderState==2||v.orderState==1?{background:"#007EFF"}:
                                v.orderState==3?{background:"#00E079"}:
                                    v.orderState==4||v.orderState==6?{background:"#E5E5E5"}:
                                        v.orderState==5?{background:"#F4B712"}:""
                        }>
                            {v.orderDescription}
                        </div>
                    </Flex>
                </WingBlank>

                    <div style={{borderBottom:"2px solid #e5e5e5",background:"#fff",paddingTop:".2rem"}}>
                        <WingBlank style={{borderBottom:"2px solid #e5e5e5"}}>
                        {v.distributorOrderGoods.map((val,i)=>{
                            return <Flex key={i} style={{marginBottom:".2rem"}}>
                                <div style={{width:"1rem",height:"1rem",marginRight:".2rem"}}>
                                    <NoLazyImg src={val.goodsImage ?val.goodsImage:""} style={{width:"100%",height:"100%"}}></NoLazyImg>
                                </div>
                                <div>
                                    <div className="Name text-two-eli"  >{ val.goodsName  }</div>
                                    <div style={{color:"#999"}}>所属店铺：{v.storeName}</div>
                                </div>
                            </Flex>
                        })}
                        </WingBlank>
                    </div>
                <div style={{padding:".2rem 0",background:"#fff"}}>
                    <WingBlank >
                        <Flex justify="between" >
                            <div>
                                <div style={{color:"#999",marginBottom:".1rem"}}>商品价格</div>
                                <div style={{color:"#ff0036",fontSize:".3rem"}}>¥{v.totalGoodsPrice}</div>
                            </div>
                            <div>
                                <div style={{color:"#999",marginBottom:".1rem"}}>成交预估收入</div>
                                <div style={{color:"#ff0036",fontSize:".3rem"}}>¥{v.totalCommission}</div>
                            </div>
                            <div>
                                <div style={{color:"#999",marginBottom:".1rem"}}>提成</div>
                                <div style={{color:"#ff0036",fontSize:".3rem"}}>{v.scale}</div>
                            </div>
                        </Flex>
                    </WingBlank>
                </div>


            </div>
        );
    }
}

export default MyStoreOrderItem;